#include "ObjectiveFlag.h"
#include "TextureManager.h"
#include "ReportError.h"
#include "Factory.h"

ObjectiveFlag::ObjectiveFlag() : m_billBoard(true)
{

}

bool ObjectiveFlag::Load(File* const f)
{

	//format is:
	//Texture path
	//x
	//y
	//z pos

	if(!f->GetString(&m_texPath))
	{
		ReportError("objective flag texture path");
		return false;
	}

	if(!f->GetFloat(&m_pos.X))
	{
		ReportError("objective flag Xpos not found");
		return false;
	}
	if(!f->GetFloat(&m_pos.Y))
	{
		ReportError("objective flag Ypos not found");
		return false;
	}
	if(!f->GetFloat(&m_pos.Z))
	{
		ReportError("objective flag Zpos not found");
		return false;
	}

	return true;
}

void ObjectiveFlag::Draw()
{
	TheTextureManager::Instance()->DrawTexture(m_texPath);
	m_billBoard.Draw();
}

void ObjectiveFlag::Update()
{

}

const char* ObjectiveFlag::GetTypeName() 
{
	return "ObjectiveFlag";
}

GameObject* CreateObjFlag()
{
	return new ObjectiveFlag;
}

static bool obj = TheGameObjectFactory::Instance()->AddToMap("ObjectiveFlag", CreateObjFlag);

